package com.wqtz.chechai.adapter;


import android.view.View;
import android.widget.TextView;

import com.orhanobut.logger.Logger;
import com.wqtz.chechai.R;
import com.wqtz.chechai.base.rebaseadapter.MyHolder;
import com.wqtz.chechai.base.rebaseadapter.RecyclerAdapter;
import com.wqtz.chechai.bean.ProviceShort;

import java.util.List;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2017/2/7 16:58
 */

public class ProvinceSortSecondAdapter extends RecyclerAdapter<ProviceShort.ResultBean.AreaListBean.ProvinceListBean> {
	sortCallBack mSortCallBack;
	public void setCallBack(sortCallBack mSortCallBack){
		this.mSortCallBack = mSortCallBack;
	}

	public ProvinceSortSecondAdapter(int rsId, List<ProviceShort.ResultBean.AreaListBean.ProvinceListBean> data) {
		super(rsId, data);
	}

	@Override
	public int itemType(int position) {
		return 0;
	}

	@Override
	public void onBindMyViewHolder(MyHolder holder, final int position, final List<ProviceShort.ResultBean.AreaListBean.ProvinceListBean> data) {
		holder.setText(R.id.province, data.get(position).getCity_name() + "");
		holder.setText(R.id.sort, data.get(position).getCity_sort() + "");
		holder.getView(R.id.ll_item).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mSortCallBack.getClickCallBack(data.get(position).getCity_sort() + "",position);
			}
		});
	}
	interface sortCallBack{
		void getClickCallBack(String sort,int position);
	}
}
